Skip to content

Add encodeCallMsg field-context errors and logTriggerConfig helper#201

Merged
ernest-nowacki merged 4 commits intomainfrom
reducePanics
Mar 6, 2026
Merged

Add encodeCallMsg field-context errors and logTriggerConfig helper#201
ernest-nowacki merged 4 commits intomainfrom
reducePanics

Conversation

@wentzeld
Copy link
Copy Markdown
Contributor

@wentzeld wentzeld commented Mar 2, 2026

Summary

  • encodeCallMsg now wraps hexToBase64 errors with field name context (e.g., Invalid hex in 'to' field of CallMsg: ...)
  • Add logTriggerConfig() helper for building validated log trigger configs from hex-encoded addresses and topics
  • Add validateHexByteLength for address (20 bytes) and topic (32 bytes) validation
  • 17 new tests

Why

Proto bytes fields use base64 in JSON form. Passing raw hex strings directly causes silent data corruption — hex chars get interpreted as base64, producing wrong bytes with no
error. These helpers ensure correct encoding and catch mistakes at build time.

Test plan

  • All 51 blockchain-helpers tests pass (34 existing + 17 new)
  • All 243 utils tests pass
  • Biome lint passes

  - encodeCallMsg now wraps hexToBase64 errors with field name context
  - Add logTriggerConfig() helper for validated hex-to-base64 log trigger config
  - Add validateHexByteLength for address (20 bytes) and topic (32 bytes) validation
  - Add 17 new tests for encodeCallMsg error context and logTriggerConfig
@wentzeld wentzeld changed the title Improve SDK error messages for common WASM panics Add encodeCallMsg field-context errors and logTriggerConfig helper Mar 2, 2026
@wentzeld
Copy link
Copy Markdown
Contributor Author

wentzeld commented Mar 2, 2026

accompanying docs pr smartcontractkit/documentation#3517

@wentzeld wentzeld marked this pull request as ready for review March 3, 2026 18:24
@wentzeld wentzeld requested review from a team as code owners March 3, 2026 18:24
@ernest-nowacki ernest-nowacki merged commit 8ed6aac into main Mar 6, 2026
10 checks passed
@ernest-nowacki ernest-nowacki deleted the reducePanics branch March 6, 2026 11:21
amit-momin added a commit that referenced this pull request Mar 31, 2026
* Bumped package.json for new chain integrations (#203)

* Add ability to pre-release (#204)

* Added Pharos Atlantic support

* Add encodeCallMsg field-context errors and logTriggerConfig helper (#201)

* Add encodeCallMsg field-context errors and logTriggerConfig helper

  - encodeCallMsg now wraps hexToBase64 errors with field name context
  - Add logTriggerConfig() helper for validated hex-to-base64 log trigger config
  - Add validateHexByteLength for address (20 bytes) and topic (32 bytes) validation
  - Add 17 new tests for encodeCallMsg error context and logTriggerConfig

* fix test

* fix linter

---------

Co-authored-by: ernest-nowacki <ernest.nowacki@smartcontract.com>

* remove node types and bun types from workflows (#199)

* remove node types and bun types from workflows

* Update comment

* Expose console types through global and add examples that serve as test that this setup actually works

* Add node modules restrictions

* Add more restricted node APIs

* Expose more apis through runtime

* TS fixes

* Fix prepare runtime

* Add links to the docs

* Update versions

* Add node modules examples

* Add documentation around workflow validation

* Add tests and fixed bug caught up by the test

* Set version for alpha

* Restore 1.1.3 version

* Simplify error messages

* Alpha release 2

* Restore correct versions

* Update version, add option to use user tsconfig

* Small fixes

* add option to do javy plugin pre-release (#207)

* Merge pull request #208 from smartcontractkit/chore/bump-cl-protos

Add new EVM mainnet and testnet chains

* Update chain-selectors dependency (#210)

* Updated chain-selectors dependency

* Updated package.json version

* Added hyperliquid mainnet and gnosis chiado support (#211)

* Code improvements (#214)

* Reproducible builds for a an OS (possibly not tied to arch)

* Remove comment that wasn't needed

* Fix generate chain selectors script (#216)

* Updated protos submodule to point to cap-dev branch

* Check types using workflow's `tsconfig` (#212)

* Update ts to be checking at build time

* running full-checks

* Remove extra alias

* Run bun-full checks with new docker support

* Update actions in github workflows (#221)

* Add CI to validate protos version on cap-dev branch (#217)

* Added CI validation to ensure protos submodule points to cap-dev branch

* Updated checkout action version

* Moved validate-submodule CI to its own workflow

* Moved permissions to job

* Updated checkout action version

---------

Co-authored-by: Ernest Nowacki <124677192+ernest-nowacki@users.noreply.github.com>
Co-authored-by: De Clercq Wentzel <10665586+wentzeld@users.noreply.github.com>
Co-authored-by: ernest-nowacki <ernest.nowacki@smartcontract.com>
Co-authored-by: Ryan Tinianov <tinianov@live.com>
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.

2 participants