Replies: 1 comment
TL;DRNothing is missing from the transport layer — the Verified reproductioncontract Ballot {
uint[] public arr; // stands in for Proposal[] public proposals
constructor() { arr.push(100); } // only index 0 exists
// in-contract access: this is the path Panic(0x32) actually applies to
function internalAccess(uint256 i) external view returns (uint256) {
return arr[i];
}
}Raw RPC against the deployed contract (solc 0.8.28, so this is not a 0.8.5-era quirk): $ cast call $ADDR 'arr(uint256)' 1
error code 3: execution reverted, data: "0x"
# ^ your exact ErrorPayload { code: 3, message: "execution reverted", data: Some(RawValue("0x")) }
$ cast call $ADDR 'internalAccess(uint256)' 1
error code 3: execution reverted: panic: array out-of-bounds access (0x32),
data: "0x4e487b7100000000000000000000000000000000000000000000000000000000000032"
$ cast call $ADDR 'arr(uint256)' 0
0x0000000000000000000000000000000000000000000000000000000000000064And the same distinction expressed as Foundry assertions: // generated getter, out of bounds -> EMPTY revert data
vm.expectRevert(bytes(""));
b.arr(1);
// in-contract access, out of bounds -> documented Panic(0x32)
vm.expectRevert(stdError.indexOOBError);
b.internalAccess(1);Both pass, which pins down where each behavior lives. Why this trips people upThe generated accessor performs its bounds check with a bare How to get useful failure info instead
|
Uh oh!
There was an error while loading. Please reload this page.
Hello, I am trying to get the panic message data hex code.
Proposal[] public proposals;ballot.proposals(U256::from(1)).call().await;Here is my response:
TransportError(ErrorResp(ErrorPayload { code: 3, message: "execution reverted", data: Some(RawValue("0x")) }))I have tried forking a local node to Anvil, and using Sepolia on Infura and QuickNode.
According to the docs, I should get a Panic error.
https://docs.soliditylang.org/en/v0.8.5/control-structures.html#error-handling-assert-require-revert-and-exceptions
I do not understand what I am missing.
All reactions