Open davidyuk opened 3 weeks ago
It was mentioned in other issues, but I think better to have a separate one.
I'm running mdw in dev mode locally. I've sent 100ae an account, then called http://localhost:3313/rollback?height=0. I expect the balance to be zero, but http://localhost:3013/v3/accounts/ak_8eAGBq1jP4dLsmnmgnSzRBxSh5SU1AVsgbCwSQcXZVwwB6c1t still returns 100ae.
I think this feature can be implemented in a hacky way, usually dev mode chains are not very long. So maybe middleware can drop its database and sync with the node again if /rollback is called?
/rollback
Configuration I'm using docker-compose.yml
services: middleware: image: davidyuk/temp:mdw-dev-mode # https://github.com/aeternity/ae_mdw/issues/1758 ports: [4000:4000, 4001:4001, 3013:3013, 3313:3313] volumes: - ./aeternity.yaml:/home/aeternity/aeternity.yaml stop_grace_period: 0s
aeternity.yaml
system: dev_mode: true plugins: - name: aeplugin_dev_mode dev_mode: auto_emit_microblocks: true chain: persist: false hard_forks: "1": 0 "6": 1 genesis_accounts: ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E: 1000000000000000000000000 fork_management: network_id: ae_dev mining: beneficiary: ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
reproduction.mjs
import { execSync } from 'child_process'; import { Node, AeSdk, MemoryAccount } from '@aeternity/aepp-sdk'; // 13.3.2 try { execSync( 'docker compose exec middleware ./bin/ae_mdw rpc ":aeplugin_dev_mode_app.start_unlink()"', { stdio : 'pipe' }, ); } catch (error) { if (!error.message.includes('{:error, {:already_started')) throw error; } const aeSdk = new AeSdk({ nodes: [{ name: 'testnet', instance: new Node('http://localhost:3013') }], accounts: [ new MemoryAccount('9ebd7beda0c79af72a42ece3821a56eff16359b6df376cf049aee995565f022f840c974b97164776454ba119d84edc4d6058a8dec92b6edc578ab2d30b4c4200'), ], }); const account = new MemoryAccount('212c8db7c62f9048c6f40d0ed41b1f31dc8e344610a822c14498012e649a4d3711595f29929814cb3d0885104a4090252355b0518998d865e24d8afb15359ba5'); await aeSdk.spend(200e18, account.address); console.log('account.address', account.address); await (async function rollbackToFirstBlock() { const { status } = await fetch('http://localhost:3313/rollback?height=0'); if (status !== 200) throw new Error(`Unexpected status code: ${status}`); })();
The complete version in https://github.com/aeternity/aepp-base
It was mentioned in other issues, but I think better to have a separate one.
I'm running mdw in dev mode locally. I've sent 100ae an account, then called http://localhost:3313/rollback?height=0. I expect the balance to be zero, but http://localhost:3013/v3/accounts/ak_8eAGBq1jP4dLsmnmgnSzRBxSh5SU1AVsgbCwSQcXZVwwB6c1t still returns 100ae.
I think this feature can be implemented in a hacky way, usually dev mode chains are not very long. So maybe middleware can drop its database and sync with the node again if
/rollback
is called?Configuration I'm using docker-compose.yml
aeternity.yaml
reproduction.mjs
The complete version in https://github.com/aeternity/aepp-base