Skip to content

Bump ugorji/go/codec and remove codecgen - #547

Open
friedemannf wants to merge 2 commits into
developfrom
bump-go-codec
Open

Bump ugorji/go/codec and remove codecgen#547
friedemannf wants to merge 2 commits into
developfrom
bump-go-codec

Conversation

@friedemannf

@friedemannf friedemannf commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Benchmarks

func BenchmarkBlock_Small_JSONUnmarshal(b *testing.B) {

Before

BenchmarkBlock_Small_JSONUnmarshal
BenchmarkBlock_Small_JSONUnmarshal-12     	  351284	      3520 ns/op
BenchmarkBlock_Medium_JSONUnmarshal
BenchmarkBlock_Medium_JSONUnmarshal-12    	   22908	     52183 ns/op
BenchmarkBlock_Large_JSONUnmarshal
BenchmarkBlock_Large_JSONUnmarshal-12     	    3014	    412256 ns/op
BenchmarkBlock_XL_JSONUnmarshal
BenchmarkBlock_XL_JSONUnmarshal-12        	     358	   3746920 ns/op

After

BenchmarkBlock_Small_JSONUnmarshal
BenchmarkBlock_Small_JSONUnmarshal-12     	  267518	      4241 ns/op
BenchmarkBlock_Medium_JSONUnmarshal
BenchmarkBlock_Medium_JSONUnmarshal-12    	   19368	     61072 ns/op
BenchmarkBlock_Large_JSONUnmarshal
BenchmarkBlock_Large_JSONUnmarshal-12     	    2614	    471092 ns/op
BenchmarkBlock_XL_JSONUnmarshal
BenchmarkBlock_XL_JSONUnmarshal-12        	     314	   3814720 ns/op

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-evm

⚠️ Breaking Changes (8)

pkg/types/blocks.(*BlockInternal) (3)
  • CodecDecodeSelf — 🗑️ Removed

  • CodecEncodeSelf — 🗑️ Removed

  • IsCodecEmpty — 🗑️ Removed

pkg/types/blocks.(*TransactionInternal) (3)
  • CodecDecodeSelf — 🗑️ Removed

  • CodecEncodeSelf — 🗑️ Removed

  • IsCodecEmpty — 🗑️ Removed

pkg/types/blocks.(*TxType) (1)
  • CodecDecodeSelf — 🗑️ Removed
pkg/types/blocks.TxType (1)
  • CodecEncodeSelf — 🗑️ Removed

✅ Compatible Changes (1)

pkg/types/blocks.(*TxType) (1)
  • MarshalJSON — ➕ Added

📄 View full apidiff report

@friedemannf
friedemannf marked this pull request as ready for review September 4, 2026 17:30
Copilot AI lite review requested due to automatic review settings September 4, 2026 17:30
@friedemannf
friedemannf requested review from a team as code owners September 4, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

TxType.MarshalJSON can panic on a nil receiver, which is plausible when invoked via interface-based marshaling (e.g., through go/codec).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the project’s JSON serialization path for EVM block/transaction intermediate types by upgrading github.com/ugorji/go/codec and removing the previously checked-in codecgen output, relying on non-generated behavior instead.

Changes:

  • Bump github.com/ugorji/go/codec from v1.2.12 to v1.3.2.
  • Remove codecgen usage: delete generated internal_types_codecgen.go, remove the //go:generate codecgen ... directive, and drop the codecgen Makefile target.
  • Add TxType.MarshalJSON to ensure go/codec can use the custom JSON unmarshaller/serialization behavior for TxType.
File summaries
File Description
pkg/types/blocks/transactions.go Adds TxType.MarshalJSON alongside the existing custom UnmarshalJSON.
pkg/types/blocks/internal_types_codecgen.go Removes generated codecgen implementation.
pkg/types/blocks/block.go Removes //go:generate codecgen ... directive.
Makefile Removes codecgen install target and from generate dependencies.
go.mod / go.sum Updates github.com/ugorji/go/codec dependency version and sums.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +15 to +19
func (txt *TxType) MarshalJSON() ([]byte, error) {
// go/codec requires both Marshaler and Unmarshaler to be implemented in order to use either of them:
// https://github.com/ugorji/go/blob/master/codec/decode.go#L1853:L1854
return json.Marshal(hexutil.Uint64(*txt))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants