Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist committed Jul 1, 2024
1 parent 8e3a7e8 commit c0b56fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
26 changes: 10 additions & 16 deletions contracts/contracts/Subcall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ library Subcall {
error InvalidMap();

/// While parsing CBOR structure, data length was unexpected
error InvalidLength(uint);
error InvalidLength(uint256);

/// Invalid receipt ID
error InvalidReceiptId();
Expand Down Expand Up @@ -189,32 +189,26 @@ library Subcall {
returns (uint256 newOffset, uint256 value)
{
uint8 prefix = uint8(result[offset]);
uint len;
uint256 len;

if( prefix <= 0x17 ) {
if (prefix <= 0x17) {
return (offset + 1, prefix);
}
// byte array, parsed as a big-endian integer
else if ( prefix & 0x40 == 0x40 )
{
else if (prefix & 0x40 == 0x40) {
len = uint8(result[offset++]) ^ 0x40;
}
// unsigned integer, CBOR encoded
else if( prefix & 0x10 == 0x10 )
{
if( prefix == 0x18 ) {
else if (prefix & 0x10 == 0x10) {
if (prefix == 0x18) {
len = 1;
}
else if( prefix == 0x19 ) {
} else if (prefix == 0x19) {
len = 2;
}
else if( prefix == 0x1a ) {
} else if (prefix == 0x1a) {
len = 4;
}
else if( prefix == 0x1b ) {
} else if (prefix == 0x1b) {
len = 8;
}
else {
} else {
revert InvalidUintSize(prefix);
}
offset += 1;
Expand Down
8 changes: 6 additions & 2 deletions contracts/test/subcall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,14 @@ describe('Subcall', () => {
expect(result.receipt).eq(nextReceiptId);

// Try decoding undelegate start receipt
const undelegateDecoded = await contract.testDecodeReceiptUndelegateStart(resultBytes);
const undelegateDecoded = await contract.testDecodeReceiptUndelegateStart(
resultBytes,
);
expect(undelegateDecoded[1]).eq(result.receipt);

const initialContractBalance = await ethers.provider.getBalance(await contract.getAddress())
const initialContractBalance = await ethers.provider.getBalance(
await contract.getAddress(),
);

await dockerSkipEpochs({ targetEpoch: result.epoch });

Expand Down

0 comments on commit c0b56fd

Please sign in to comment.