Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Adjusting bios contracts and adding kv_bios #805

Merged
merged 9 commits into from
Nov 19, 2020
Merged
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
37 changes: 9 additions & 28 deletions .github/eosjs-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
### Current Version: v0.2.5
### Current Version: v0.2.7
### Test:
#### docker build --tag eosjs-ci:test ./.github/eosjs-ci
#### docker run --publish 8888:8888 eosjs-ci:test
### Deploy:
#### docker build --tag eosio/eosjs-ci:v0.2.5 ./.github/eosjs-ci
#### docker push eosio/eosjs-ci:v0.2.5
#### docker build --tag eosio/eosjs-ci:v0.2.7 ./.github/eosjs-ci
#### docker push eosio/eosjs-ci:v0.2.7

FROM ubuntu:18.04 AS builder
FROM ubuntu:18.04
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--verbose-http-errors", "--max-transaction-time=100"]

### base
RUN yes | unminimize \
Expand Down Expand Up @@ -74,30 +75,10 @@ RUN git clone https://github.com/EOSIO/eos.git \
&& mkdir build \
&& cd build \
&& CC=clang-8 CXX=clang++-8 cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_AR=/usr/bin/llvm-ar-8 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-8 -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld .. \
&& CC=clang-8 CXX=clang++-8 ninja -j5


FROM ubuntu:18.04
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--verbose-http-errors", "--max-transaction-time=100"]

RUN yes | unminimize \
&& apt-get update \
&& apt-get install -yq \
curl \
git \
python \
wget \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash -

ENV LANG=en_US.UTF-8

WORKDIR /root/
RUN mkdir -p /root/eos/build/bin

WORKDIR /root/eos/build/bin
COPY --from=builder /root/eos/build/bin/* ./

ENV PATH="/root/eos/build/bin/:${PATH}"
&& CC=clang-8 CXX=clang++-8 ninja -j5 \
&& sudo ninja install \
&& sudo ln -s /usr/lib/x86_64-linux-gnu/cmake/eosio/ /usr/lib/cmake/eosio \
&& rm -rf /root/eos

RUN mkdir -p "/opt/eosio/bin/contracts"

Expand Down
83 changes: 55 additions & 28 deletions .github/eosjs-ci/scripts/deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ function setabi {
fi
}

# $1 - account name
# $2 - public key
# $3 - private key
function create_account {
cleos wallet import --private-key $3
cleos create account eosio $1 $2
}

# Move into the executable directory
cd $ROOT_DIR/bin/
mkdir -p $CONFIG_DIR
Expand Down Expand Up @@ -151,33 +143,63 @@ echo "Creating accounts and deploying contracts"
start_wallet

sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
create_account eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY $SYSTEM_ACCOUNT_PRIVATE_KEY
create_account returnvalue $SYSTEM_ACCOUNT_PUBLIC_KEY $SYSTEM_ACCOUNT_PRIVATE_KEY
create_account todo $SYSTEM_ACCOUNT_PUBLIC_KEY $SYSTEM_ACCOUNT_PRIVATE_KEY
create_account bob $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account alice $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account cfhello $CFHELLO_PUBLIC_KEY $CFHELLO_PRIVATE_KEY

cleos wallet import --private-key $EXAMPLE_ACCOUNT_PRIVATE_KEY
cleos wallet import --private-key $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
cleos wallet import --private-key $CFHELLO_PRIVATE_KEY
cleos wallet import --private-key $CFACTOR_PRIVATE_KEY
cleos create account eosio eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio returnvalue $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio todo $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio bob $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alice $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio cfhello $CFHELLO_PUBLIC_KEY
cleos create account cfhello cfactor $CFACTOR_PUBLIC_KEY

# preactivate concensus upgrades
post_preactivate

sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
setabi eosio $CONTRACTS_DIR/boot/boot.abi
setcode eosio $CONTRACTS_DIR/boot/boot.wasm
sleep 2s
cleos push action eosio boot "[]" -p eosio@active
setabi eosio $CONTRACTS_DIR/eosio.bios-v1.8.3/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios-v1.8.3/eosio.bios.wasm

sleep 1s
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"

sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.wasm

sleep 1s
activate_feature "825ee6288fb1373eab1b5187ec2f04f6eacb39cb3a97f356a07c91622dd61d16"
activate_feature "c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"
activate_feature "4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"
activate_feature "f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"
activate_feature "2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"
activate_feature "8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405"
activate_feature "ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43"
activate_feature "68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428"
activate_feature "e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526"
activate_feature "ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"
activate_feature "4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"
activate_feature "1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"
activate_feature "bf61537fd21c61a60e542a5d66c3f6a78da0589336868307f94a82bccea84e88"
activate_feature "5443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b4"

sleep 1s
cleos set abi eosio $CONTRACTS_DIR/kv_bios/kv_bios.abi -p eosio@active
cleos set code eosio $CONTRACTS_DIR/kv_bios/kv_bios.wasm -p eosio@active

sleep 1s
cleos push action eosio ramkvlimits "[1024, 4096, 1024]" -p eosio@active

sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
setcode eosio $CONTRACTS_DIR/system/system.wasm
setabi eosio $CONTRACTS_DIR/system/system.abi
setabi eosio $CONTRACTS_DIR/ret_bios/ret_bios.abi
setcode eosio $CONTRACTS_DIR/ret_bios/ret_bios.wasm

sleep 1s
cleos push action eosio retmaxlim "[]" -p eosio@active

sleep 1s
cleos set abi cfhello $CONTRACTS_DIR/cfhello/cfhello.abi -p cfhello@active -p eosio@active
Expand All @@ -192,15 +214,20 @@ cleos set abi returnvalue $CONTRACTS_DIR/action_results/action_results.abi -p re
cleos set code returnvalue $CONTRACTS_DIR/action_results/action_results.wasm -p returnvalue@active -p eosio@active

sleep 1s
cleos set abi eosio.token $CONTRACTS_DIR/token/token.abi -p eosio.token@active -p eosio@active
cleos set code eosio.token $CONTRACTS_DIR/token/token.wasm -p eosio.token@active -p eosio@active
cleos set abi eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.abi -p eosio.token@active -p eosio@active
cleos set code eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.wasm -p eosio.token@active -p eosio@active

sleep 1s
cleos push action eosio.token create '["bob", "10000000000.0000 SYS"]' -p eosio.token
cleos push action eosio.token issue '["bob", "5000000000.0000 SYS", "Half of available supply"]' -p bob
cleos push action eosio.token transfer '["bob", "alice", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "bobr1", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "alicer1", "1000000.0000 SYS", "memo"]' -p bob

cleos push action todo upsert '["bf581bee-9f2c-447b-94ad-78e4984b6f51", "todo", "Write Hello World Contract", false]' -p todo@active
cleos push action todo upsert '["b7b0d09d-a82b-44d9-b067-3bae2d02917e", "todo", "Start Blockchain", false]' -p todo@active
cleos push action todo upsert '["ac8acfe7-cd4e-4d22-8400-218b697a4517", "todo", "Deploy Hello World Contract", false]' -p todo@active

echo "All done initializing the blockchain"

if [[ -z $NODEOS_RUNNING ]]; then
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
token: ${{ github.token }}
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1c5c1375b3817ad821719597effe8e3d6f764930
uses: actions/setup-node@c6fd00ceb9747fb23ffdf72987450a2664414867
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
Expand All @@ -55,7 +55,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@8aac1d019734a107e4eaaefe2e26beb3149e5540
uses: cypress-io/github-action@6e9b583c9652e99b72b042a3957980fc6166efae
with:
spec: cypress/integration/index.spec.js
- name: Get Protected Status
Expand All @@ -73,7 +73,7 @@ jobs:
git push origin ${GITHUB_REF#refs/*/}
services:
nodeos:
image: eosio/eosjs-ci:v0.2.5
image: eosio/eosjs-ci:v0.2.7

ports:
- 8888:8888
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Checkout
uses: actions/checkout@f90c7b395dac7c5a277c1a6d93d5057c1cddb74e
- name: Setup Node.js
uses: actions/setup-node@1c5c1375b3817ad821719597effe8e3d6f764930
uses: actions/setup-node@c6fd00ceb9747fb23ffdf72987450a2664414867
with:
node-version: '12.14.1'
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@8aac1d019734a107e4eaaefe2e26beb3149e5540
uses: cypress-io/github-action@6e9b583c9652e99b72b042a3957980fc6166efae
with:
spec: cypress/integration/index.spec.js
- name: Publish Edge
Expand All @@ -58,7 +58,7 @@ jobs:

services:
nodeos:
image: eosio/eosjs-ci:v0.2.5
image: eosio/eosjs-ci:v0.2.7

ports:
- 8888:8888
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Checkout
uses: actions/checkout@f90c7b395dac7c5a277c1a6d93d5057c1cddb74e
- name: Setup Node.js
uses: actions/setup-node@1c5c1375b3817ad821719597effe8e3d6f764930
uses: actions/setup-node@c6fd00ceb9747fb23ffdf72987450a2664414867
with:
node-version: '12.14.1'
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@8aac1d019734a107e4eaaefe2e26beb3149e5540
uses: cypress-io/github-action@6e9b583c9652e99b72b042a3957980fc6166efae
with:
spec: cypress/integration/index.spec.js
- name: Publish Release
Expand All @@ -57,7 +57,7 @@ jobs:

services:
nodeos:
image: eosio/eosjs-ci:v0.2.5
image: eosio/eosjs-ci:v0.2.7

ports:
- 8888:8888
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Checkout
uses: actions/checkout@f90c7b395dac7c5a277c1a6d93d5057c1cddb74e
- name: Setup Node.js
uses: actions/setup-node@1c5c1375b3817ad821719597effe8e3d6f764930
uses: actions/setup-node@c6fd00ceb9747fb23ffdf72987450a2664414867
with:
node-version: '12.14.1'
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@8aac1d019734a107e4eaaefe2e26beb3149e5540
uses: cypress-io/github-action@6e9b583c9652e99b72b042a3957980fc6166efae
with:
spec: cypress/integration/index.spec.js
- name: Publish RC
Expand All @@ -117,7 +117,7 @@ jobs:

services:
nodeos:
image: eosio/eosjs-ci:v0.2.5
image: eosio/eosjs-ci:v0.2.7

ports:
- 8888:8888
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"devDependencies": {
"@blockone/eslint-config-blockone": "^3.0.0",
"@types/elliptic": "^6.4.12",
"@types/jest": "^26.0.14",
"@types/node": "^14.11.5",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.8",
"@types/pako": "^1.0.1",
"cypress": "^4.12.1",
"eosjs-ecc": "^4.0.7",
"eslint": "^6.8.0",
"jest": "^26.5.2",
"jest": "^26.6.3",
"jest-fetch-mock": "^3.0.3",
"ts-jest": "^26.4.1",
"ts-jest": "^26.4.4",
"ts-loader": "^7.0.5",
"typescript": "^3.9.7",
"webpack": "^4.44.2",
Expand Down
12 changes: 2 additions & 10 deletions src/tests/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ const setWasmAbi = async () => {
textDecoder: api.textDecoder,
print: (x) => { process.stdout.write(x); },
}),
new WasmAbi({
account: 'returnvalue',
mod: new global.WebAssembly.Module(fs.readFileSync(path.join(__dirname + '/action_results_abi.wasm'))),
memoryThreshold: 32000,
textEncoder: api.textEncoder,
textDecoder: api.textDecoder,
print: (x) => { process.stdout.write(x); },
})
]);
};

Expand Down Expand Up @@ -214,9 +206,9 @@ const transactWithShorthandTxWasm = async () => {
};

const transactWithReturnValue = async () => {
await setWasmAbi();
await api.getAbi('returnvalue');
const tx = api.buildTransaction();
tx.with('returnvalue').as('bob').actionresret();
tx.with('returnvalue').as('bob').sum(5, 5);
return await tx.send({
blocksBehind: 3,
expireSeconds: 30
Expand Down
18 changes: 2 additions & 16 deletions src/tests/web.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
tokenModule = await WebAssembly.compile(buffer);
}

if (!rvModule) {
response = await fetch('action_results_abi.wasm');
buffer = await response.arrayBuffer();
rvModule = await WebAssembly.compile(buffer);
}

await api.wasmAbiProvider.setWasmAbis([
new eosjs_wasmabi.WasmAbi({
account: 'eosio.token',
Expand All @@ -48,14 +42,6 @@
textDecoder: new TextDecoder('utf-8', { fatal: true }),
print: (x) => console.info(x),
}),
new eosjs_wasmabi.WasmAbi({
account: 'returnvalue',
mod: rvModule,
memoryThreshold: 32000,
textEncoder: new TextEncoder,
textDecoder: new TextDecoder('utf-8', { fatal: true }),
print: (x) => console.info(x),
})
]);
};

Expand Down Expand Up @@ -552,9 +538,9 @@
};

const returnValueTx = async () => {
await setWasmAbi();
await api.getAbi('returnvalue');
const tx = api.buildTransaction();
tx.with('returnvalue').as('bob').actionresret();
tx.with('returnvalue').as('bob').sum(5, 5);
return tx.send({
blocksBehind: 3,
expireSeconds: 30
Expand Down
Loading