-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ceres initializer and docs
- Loading branch information
Showing
14 changed files
with
231 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Upcoming Hard-Fork / Ceres Support | ||
|
||
Aeproject can already be used for testing and setup with the upcoming Ceres hard-fork. | ||
|
||
### Automatic update | ||
|
||
Use `aeproject init --next ` to initialize a new project that has the necessary adjustments for ceres applied. | ||
|
||
Use `aeproject init --update --next` to update an existing project with the adjustments for ceres. For updating existing tests implemented change occurrences of `utils.getSdk()` to `utils.getSdk({ ignoreVersion: true })` or use the same option for manually initialized sdk `Node` and `CompilerHttp`. | ||
|
||
### Manual update | ||
|
||
- change occurrences of `utils.getSdk()` to `utils.getSdk({ ignoreVersion: true })` or use the same option for manually initialized sdk `Node` and `CompilerHttp` | ||
- update `docker/aeternity.yml` to include | ||
```yaml | ||
chain: | ||
hard_forks: | ||
"1": 0 | ||
"6": 1 | ||
``` | ||
- update `docker-compose.yml` to use the `latest` node and compiler tags or specify it manually in running with `aeproject env --nodeVersion latest --compilerVersion latest` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: "3.6" | ||
services: | ||
aeproject_node: | ||
image: aeternity/aeternity:${NODE_TAG:-latest}-bundle | ||
hostname: node | ||
environment: | ||
AETERNITY_CONFIG: /home/aeternity/aeternity.yaml | ||
AE__SYSTEM__CUSTOM_PREFUNDED_ACCS_FILE: "/home/aeternity/node/data/aecore/.genesis/accounts_test.json" | ||
volumes: | ||
- "./docker/aeternity.yaml:/home/aeternity/aeternity.yaml" | ||
- "./docker/accounts.json:/home/aeternity/node/data/aecore/.genesis/accounts_test.json" | ||
|
||
aeproject_compiler: | ||
image: aeternity/aesophia_http:${COMPILER_TAG:-latest} | ||
hostname: compiler | ||
ports: | ||
- "3080:3080" | ||
|
||
aeproject_proxy: | ||
image: nginx:latest | ||
hostname: proxy | ||
ports: | ||
- "3001:3001" | ||
volumes: | ||
- "./docker/nginx.conf:/etc/nginx/conf.d/default.conf" | ||
depends_on: | ||
- aeproject_compiler | ||
- aeproject_node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
http: | ||
external: | ||
gas_limit: 60000000 | ||
internal: | ||
debug_endpoints: true | ||
listen_address: 0.0.0.0 | ||
endpoints: | ||
dry-run: true | ||
|
||
system: | ||
plugin_path: /home/aeternity/node/plugins | ||
plugins: | ||
- name: aeplugin_dev_mode | ||
config: # keeping the old config style at first to stay backwards compatible | ||
keyblock_interval: 0 | ||
microblock_interval: 0 | ||
auto_emit_microblocks: true | ||
|
||
dev_mode: | ||
keyblock_interval: 0 | ||
microblock_interval: 0 | ||
auto_emit_microblocks: true | ||
|
||
fork_management: | ||
network_id: ae_dev | ||
|
||
chain: | ||
hard_forks: | ||
"1": 0 | ||
"6": 1 | ||
persist: true | ||
consensus: | ||
"0": | ||
name: "on_demand" # keeping the old config style at first to stay backwards compatible | ||
type: "on_demand" | ||
|
||
mining: | ||
beneficiary: "ak_RdoCvwe7kxPu2VBv2gQAc1V81sGyTTuxFv36AcvNQYZN7qgut" | ||
beneficiary_reward_delay: 2 | ||
strictly_follow_top: true | ||
|
||
websocket: | ||
channel: | ||
port: 3014 | ||
listen_address: 0.0.0.0 | ||
|
||
logging: | ||
# Controls the overload protection in the logs. | ||
hwm: 50 | ||
level: debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { assert } = require("chai"); | ||
const { utils } = require("@aeternity/aeproject"); | ||
const chaiAsPromised = require("chai-as-promised"); | ||
const chai = require("chai"); | ||
|
||
chai.use(chaiAsPromised); | ||
|
||
const EXAMPLE_CONTRACT_SOURCE = "./contracts/ExampleContract.aes"; | ||
|
||
describe("ExampleContract", () => { | ||
let aeSdk; | ||
let contract; | ||
|
||
before(async () => { | ||
aeSdk = utils.getSdk({ ignoreVersion: true }); | ||
|
||
// a filesystem object must be passed to the compiler if the contract uses custom includes | ||
const fileSystem = utils.getFilesystem(EXAMPLE_CONTRACT_SOURCE); | ||
|
||
// get content of contract | ||
const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE); | ||
|
||
// initialize the contract instance | ||
contract = await aeSdk.initializeContract({ sourceCode, fileSystem }); | ||
await contract.init(); | ||
|
||
// create a snapshot of the blockchain state | ||
await utils.createSnapshot(aeSdk); | ||
}); | ||
|
||
// after each test roll back to initial state | ||
afterEach(async () => { | ||
await utils.rollbackSnapshot(aeSdk); | ||
}); | ||
|
||
it("ExampleContract: set and get", async () => { | ||
const set = await contract.set(42, { | ||
onAccount: utils.getDefaultAccounts()[1], | ||
}); | ||
assert.equal(set.decodedEvents[0].name, "SetXEvent"); | ||
assert.equal( | ||
set.decodedEvents[0].args[0], | ||
utils.getDefaultAccounts()[1].address, | ||
); | ||
assert.equal(set.decodedEvents[0].args[1], 42); | ||
|
||
const { decodedResult } = await contract.get(); | ||
assert.equal(decodedResult, 42); | ||
}); | ||
|
||
it("ExampleContract: get undefined when not set before", async () => { | ||
await assert.isRejected(contract.get(), "NOTHING_SET_YET"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters