Skip to content

Commit

Permalink
remove global state (#19)
Browse files Browse the repository at this point in the history
* Remove the global state for hotshot height
  • Loading branch information
ImJeremyHe authored Aug 27, 2024
1 parent 9f1a666 commit d226e9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/state/Deserialize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ library Deserialize {

// using constant ints for array size requires newer solidity
bytes32[2] memory bytes32Vals;
uint64[3] memory u64Vals;
uint64[2] memory u64Vals;

for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) {
(bytes32Vals[i], offset) = b32(proof, offset);
Expand Down
10 changes: 4 additions & 6 deletions src/state/GlobalState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ pragma solidity ^0.8.0;

struct GlobalState {
bytes32[2] bytes32Vals;
uint64[3] u64Vals;
uint64[2] u64Vals;
}

library GlobalStateLib {
uint16 internal constant BYTES32_VALS_NUM = 2;
uint16 internal constant U64_VALS_NUM = 3;
uint16 internal constant U64_VALS_NUM = 2;

function hash(GlobalState memory state) internal pure returns (bytes32) {
return
Expand All @@ -21,8 +21,7 @@ library GlobalStateLib {
state.bytes32Vals[0],
state.bytes32Vals[1],
state.u64Vals[0],
state.u64Vals[1],
state.u64Vals[2]
state.u64Vals[1]
)
);
}
Expand All @@ -47,7 +46,6 @@ library GlobalStateLib {
return (state.bytes32Vals[0] == bytes32(0) &&
state.bytes32Vals[1] == bytes32(0) &&
state.u64Vals[0] == 0 &&
state.u64Vals[1] == 0 &&
state.u64Vals[2] == 0);
state.u64Vals[1] == 0);
}
}

0 comments on commit d226e9d

Please sign in to comment.