Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_beacon_randomness returns OutOfGas with epoch from the future #2056

Open
anorth opened this issue Oct 13, 2024 · 1 comment
Open

get_beacon_randomness returns OutOfGas with epoch from the future #2056

anorth opened this issue Oct 13, 2024 · 1 comment
Labels
Kind: Bug Something isn't working

Comments

@anorth
Copy link
Member

anorth commented Oct 13, 2024

When testing the new randomness syscall (implemented in built-in actors), which allows the caller to specify the epoch, @ZenGround0 received an out-of-gas when using an epoch from the future. The call should fail, but return an error corresponding to illegal argument (or possibly limit exceeded).

server returned an error response: error code 1: message execution failed: exit SysErrOutOfGas(7), revert reason: none, vm error: message failed with backtrace:
00: f01009 (method 3844450837) -- out of gas (7)
 (RetCode=7)

Called via https://github.com/filecoin-project/builtin-actors/blob/12d9af8a00d0909598c67e1a18dc1577e0833137/runtime/src/runtime/fvm.rs#L268-L280

@anorth anorth added the Kind: Bug Something isn't working label Oct 13, 2024
@Stebalien
Copy link
Member

Ah... I found the issue. The FVM is trying to return an illegal argument error in this case:

.checked_sub(rand_epoch)
.ok_or_else(|| syscall_error!(IllegalArgument; "randomness epoch {} is in the future", rand_epoch))?;

But ChainEpoch is an i64, not a u64. So lookback is allowed to be negative which gives us an infinite gas charge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants