Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
with:
command: fmt
args: --all -- --check

test:
name: Test with ${{ matrix.rust }} rust on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -116,3 +116,55 @@ jobs:
files: ./lcov.info,./lcov-mini.info
fail_ci_if_error: true
verbose: false

node:
name: Node integration test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:longsleep/golang-backports
sudo apt-get update && sudo apt-get install -y \
autoconf automake cmake libboost-dev libboost-filesystem-dev libgmp-dev \
librocksdb-dev libssl-dev libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev \
liblz4-dev libzstd-dev libtool golang-go clang-format cmake
sudo apt-get install librocksdb-dev
#
# If apt's rocksdb is ever out of date, we'll need to use the following
# git clone -b v6.11.4 https://github.com/facebook/rocksdb
# cd rocksdb && make shared_lib && sudo make install
#

- name: Clone Arbitrum
run: |
git clone --recursive https://github.com/OffchainLabs/arbitrum.git
cd arbitrum && git submodule update --init --recursive

- name: Copy over this branch's ArbOS
run: |
rm -r arbitrum/packages/arb-os/*
mv * arbitrum/packages/arb-os/ || true

- name: Build Arbitrum
run: |
mkdir arbitrum/packages/arb-avm-cpp/debug/
cd $_
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j

- name: Test Node's C++ Database
run: |
./arbitrum/packages/arb-avm-cpp/debug/bin/avm_tests

- name: Test Node's RPC
run: |
cd arbitrum/packages/arb-rpc-node/
go test ./...

- name: Test Node's Core
run: |
cd arbitrum/packages/arb-node-core/
go test ./...
2 changes: 1 addition & 1 deletion arb_os/arbos-upgrade.mexe

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arb_os/arbos.mexe

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arb_os/upgrade.json

Large diffs are not rendered by default.

21 changes: 9 additions & 12 deletions stdlib/ripemd160.mini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Ripemd160Hasher = struct {
public func ripemd160hasher_new() -> Ripemd160Hasher {
return struct {
accumulator: bytes32(0x67452301EFCDAB8998BADCFE10325476C3D2E1F0),
buf: unsafecast<[2]uint>((0,0)),
buf: newfixedarray(2, 0),
offset: 0,
totalSizeBytes: 0,
};
Expand All @@ -35,7 +35,7 @@ public func ripemd160hasher_pushByte(h: Ripemd160Hasher, b: uint) -> Ripemd160Ha
h with {
accumulator: asm(h.accumulator, newBuffer[0], newBuffer[1]) bytes32 { ripemd160f }
} with {
buf: unsafecast<[2]uint>((0,0))
buf: newfixedarray(2, 0)
} with {
offset: 0
} with {
Expand Down Expand Up @@ -66,7 +66,7 @@ public func ripemd160hasher_push256(h: Ripemd160Hasher, val: uint) -> Ripemd160H
h with {
accumulator: asm(h.accumulator, h.buf[0], val) bytes32 { ripemd160f }
} with {
buf: unsafecast<[2]uint>((0,0))
buf: newfixedarray(2, 0)
} with {
offset: 0
} with {
Expand All @@ -93,10 +93,7 @@ public func ripemd160hasher_push256(h: Ripemd160Hasher, val: uint) -> Ripemd160H
h.buf[1] | (val >> (8*offset))
) bytes32 { ripemd160f }
} with {
buf: unsafecast<[2]uint>((
val << (8*(32-offset)),
0
))
buf: newfixedarray(2, 0) with { [0] = val << (8*(32-offset)) }
} with {
offset: offset
} with {
Expand All @@ -107,24 +104,24 @@ public func ripemd160hasher_push256(h: Ripemd160Hasher, val: uint) -> Ripemd160H

public func ripemd160hasher_finish(h: Ripemd160Hasher) -> bytes32 {
// write the first padding byte
h = ripemd160hasher_pushByte(h, 0x80) with {
totalSizeBytes: h.totalSizeBytes // undo the +1 caused by ripemd160hasher_pushByte call
};
h = ripemd160hasher_pushByte(h, 0x80);

// make sure there is space for the 64-bit total length
if (h.offset > 56) {
h = h with {
accumulator: asm(h.accumulator, h.buf[0], h.buf[1]) bytes32 { ripemd160f }
} with {
buf: unsafecast<[2]uint>((0,0))
buf: newfixedarray(2, 0)
} with {
offset: 0
};
}

// insert the total size, and invoke the compression function
return asm(
h.accumulator,
h.buf[0],
h.buf[1] | flipEndian64(8*h.totalSizeBytes), //TODO: check endianness
h.buf[1] | flipEndian64(8*(h.totalSizeBytes-1)), // -1 to compensate for the 0x80 padding byte
) bytes32 { ripemd160f };
}

Expand Down
44 changes: 41 additions & 3 deletions stdlib/ripemd160test.mini
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func tests() -> uint {
if (ripemd160hasher_finish(h) != bytes32(0x74e856c137772846e18c0c6d955666133f1d32dc)) {
return 6;
}

let h = ripemd160hasher_new();
let i = 0x00;
while (i < 55) {
Expand All @@ -71,12 +71,50 @@ func tests() -> uint {
if (ripemd160hasher_finish(h) != bytes32(0x3c86963b3ff646a65ae42996e9664c747cc7e5e6)) {
return 7;
}

let h = ripemd160hasher_new();
h = ripemd160hasher_push256(h, uint(0x0cdd6941697c828be460f241d6e71106a408c854e351c54f46b6500b106e2cdb));
if (ripemd160hasher_finish(h) != bytes32(0xfe27e5ab7fdee1be58e9ee498709c337d4b54ba4)) {
return 8;
}


let h = ripemd160hasher_new();
let i = 0x00;
while (i < 56) {
h = ripemd160hasher_pushByte(h, i);
i = i + 1;
}
if (ripemd160hasher_finish(h) != bytes32(0xebdd79cfd4fd9949ef8089673d2620427f487cfb)) {
return 9;
}

let h = ripemd160hasher_new();
let i = 0x00;
while (i < 256) {
h = ripemd160hasher_pushByte(h, i);
i = i + 1;
}
if (ripemd160hasher_finish(h) != bytes32(0x9c4fa072db2c871a5635e37f791e93ab45049676)) {
return 10;
}

let h = ripemd160hasher_new();
h = ripemd160hasher_push256(h, uint(0x0cdd6941697c828be460f241d6e71106a408c854e351c54f46b6500b106e2cdb));
h = ripemd160hasher_push256(h, uint(0x44a1387fb23aaa901d387b0f5fe9d4efc005b3be1da5b591d666d26912acf46d));
if (ripemd160hasher_finish(h) != bytes32(0x6134190eedf65ab0b4d97e4682d2b5033066256f)) {
return 11;
}

let h = ripemd160hasher_new();
let i = 0x00;
while (i < 24) {
h = ripemd160hasher_pushByte(h, i);
i = i + 1;
}
h = ripemd160hasher_push256(h, uint(0x0cdd6941697c828be460f241d6e71106a408c854e351c54f46b6500b106e2cdb));
if (ripemd160hasher_finish(h) != bytes32(0xc4fd260915fc7a6cd0ff64dbf01d85ace837f297)) {
return 12;
}

return 0;
}