Skip to content

[BUG] Steel description #615

@b0gdaniy

Description

@b0gdaniy

Bug Report

In the description of Steel: https://github.com/risc0/risc0-ethereum/blob/release-1.1/steel/docs/steel-commitments.md

We have 2 subparagraphs for validation of Steel commitments:
1 - Block hash commitment
2 - Beacon Block Root Commitment

However, in the code snippets, we have the same snippet in both subparagraphs — the function validateBlockCommitment() function. This is incorrect, because the second subparagraph should contain a code snippet specifically designed for BeaconCommitment, and this snippet should be for the function validateBeaconCommitment() function:

    /// @notice Validates if the provided beacon commitment matches the block root of the given timestamp.
    /// @param timestamp The timestamp to compare against.
    /// @param blockRoot The block root to validate.
    /// @return True if the block's block root matches the block root, false otherwise.
    function validateBeaconCommitment(uint256 timestamp, bytes32 blockRoot) internal view returns (bool) {
        return blockRoot == Beacon.parentBlockRoot(timestamp);
    }

instead of

    /// @notice Validates if the provided block commitment matches the block hash of the given block number.
    /// @param blockNumber The block number to compare against.
    /// @param blockHash The block hash to validate.
    /// @return True if the block's block hash matches the block hash, false otherwise.
    function validateBlockCommitment(uint256 blockNumber, bytes32 blockHash) internal view returns (bool) {
        // NOTE: blockhash opcode returns all zeroes if the block number is too far in the past.
        bytes32 blockHashResult = blockhash(blockNumber);
        if (blockHashResult == bytes32(0)) {
            revert CommitmentTooOld();
        }
        return blockHash == blockHashResult;
    }

Steps to Reproduce

Go to https://github.com/risc0/risc0-ethereum/blob/release-1.1/steel/docs/steel-commitments.md#validation-of-steel-commitments

Expected behavior

Update the markdown text for the Beacon Block Root Commitment subparagraph:

2. Beacon Block Root Commitment

/// @notice Validates if the provided block commitment matches the block hash of the given block number.
/// @param blockNumber The block number to compare against.
/// @param blockHash The block hash to validate.
/// @return True if the block's block hash matches the block hash, false otherwise.
function validateBlockCommitment(uint256 blockNumber, bytes32 blockHash) internal view returns (bool) {
    if (block.number - blockNumber > 256) {
        revert CommitmentTooOld();
    }
    return blockHash == blockhash(blockNumber);
}

Your Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions