Skip to content

fix(contracts): default _validUntil to now + 1h instead of 0#157

Merged
MuncleUscles merged 1 commit intomainfrom
fix/valid-until-default
Apr 22, 2026
Merged

fix(contracts): default _validUntil to now + 1h instead of 0#157
MuncleUscles merged 1 commit intomainfrom
fix/valid-until-default

Conversation

@MuncleUscles
Copy link
Copy Markdown
Member

Summary

The v6 `addTransaction` signature on the consensus contract carries a `_validUntil` field. The SDK was hardcoding `0n` for it.

Empirically on Bradbury, deploys with `_validUntil = 0` are mined and then reverted inside the EVM wrapper (plain `revert()` — no reason string). The same tx with `_validUntil = block.timestamp + N` succeeds end-to-end through GenLayer consensus.

The public consensus source (e.g. `phases/IdlenessPhase.sol`, `ActivationPhase.sol`, `FinalizationPhase.sol`) treats 0 as "no expiry" (`validUntil != 0 && validUntil < block.timestamp`), so this looks like a behavioural divergence between the deployed contract on Bradbury and the public source — I've flagged it separately with the contracts team. In the meantime, this patch unblocks users so their deploys actually land.

Default chosen: `now + 3600` (1 hour). Long enough for wallet confirmation and mining; short enough that stale signed txs don't hang around.

Evidence pair (Bradbury):

  • Reverted (`validUntil = 0`): `0xf02d44dcbd0bf71b5b16d18aa924afa6aa926d2ccbd4f5abc78859fd79d61cb8`
  • Mined + accepted (`validUntil = now + 3600`): `0x26b6ad8c36417c0152bceb88a29e2b6ae4c0191b340ded2aba8bbfd0f75bf99d`

Unblocks the Studio frontend's runtime network selector (`genlayerlabs/genlayer-studio#1606`).

Test plan

  • `npm test` — 49/49 pass (existing v5/v6 selector tests still valid)
  • `npm run build` clean
  • Manually verified on Bradbury: deploy succeeds with the patch, reverts without it

The v6 `addTransaction` signature carries a `_validUntil` field. Empirically,
deploys to Bradbury with `_validUntil = 0` are mined and then reverted by
the EVM wrapper contract (no reason string), while the same tx with
`_validUntil = block.timestamp + N` succeeds. The on-chain expiry check in
the public consensus repo (`validUntil != 0 && validUntil < block.timestamp`)
treats 0 as "no expiry", so this looks like a behavioural divergence
between the deployed contract and the source — tracking separately.

In the meantime, default `_validUntil` to `now + 3600` in the v6 encoder so
users actually get their deploys mined.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@MuncleUscles has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 30 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 30 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a95d36f6-4b4c-49af-849e-529f1599ea2a

📥 Commits

Reviewing files that changed from the base of the PR and between d56036d and 9df2f9a.

📒 Files selected for processing (1)
  • src/contracts/actions.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/valid-until-default

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MuncleUscles MuncleUscles merged commit 530513f into main Apr 22, 2026
4 checks passed
@MuncleUscles MuncleUscles deleted the fix/valid-until-default branch April 22, 2026 17:00
MuncleUscles added a commit to genlayerlabs/genlayer-studio that referenced this pull request Apr 22, 2026
Picks up genlayerlabs/genlayer-js#157 — the SDK now passes a future
timestamp for _validUntil in v6 addTransaction calls, so deploys to
Bradbury from the Studio frontend actually land instead of reverting
inside the EVM wrapper with no reason string.
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.

1 participant