Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejected NameClaim immediately if no corresponding NamePreclaim #4204

Closed
davidyuk opened this issue Sep 20, 2023 · 3 comments
Closed

Rejected NameClaim immediately if no corresponding NamePreclaim #4204

davidyuk opened this issue Sep 20, 2023 · 3 comments
Labels
need/triage New issues which need to be categorized

Comments

@davidyuk
Copy link
Member

Currently, the node would accept such transactions, but its details would disappear after several blocks. Would be more developer-friendly if the node would look for the corresponding NamePreclaim transaction and reject the POST request immediately if none is found.

Reproduction

#!/bin/bash
set -ex

curl http://localhost:3013/v3/accounts/ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E | jq .

# generated using js sdk
# acc = new Sdk.MemoryAccount('9ebd7beda0c79af72a42ece3821a56eff16359b6df376cf049aee995565f022f840c974b97164776454ba119d84edc4d6058a8dec92b6edc578ab2d30b4c4200')
# tx = Sdk.buildTx({ tag: Sdk.Tag.NameClaimTx, accountId: acc.address, nonce: 1, name: 'test.chain', nameSalt: 42 })
# signed = await acc.signTransaction(tx, { networkId: 'ae_devnet' })
# hash = Sdk.buildTxHash(signed)

curl -X POST http://localhost:3013/v3/transactions \
   -H 'Content-Type: application/json' \
   -d '{"tx":"tx_+I0LAfhCuECbViGKwaxislzIUnNjV5MLIOfbFo4l7/7/WvFv4CV8FlE048akHGzYPMTsvmA123I1/eeFEUrAZ9imxrfdHGQAuEX4QyACoQGEDJdLlxZHdkVLoRnYTtxNYFio3skrbtxXirLTC0xCAAGKdGVzdC5jaGFpbiqJB0xS1EQgCUAAhg7lxBTYAABDQWRx"}' | jq .


curl http://localhost:3013/v3/transactions/th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH | jq .
sleep 5
curl http://localhost:3013/v3/transactions/th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH | jq .

Output

./reproduction.sh
+ curl http://localhost:3013/v3/accounts/ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
+ jq .
{
  "balance": 1e+41,
  "id": "ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E",
  "kind": "basic",
  "nonce": 0,
  "payable": true
}
+ curl -X POST http://localhost:3013/v3/transactions -H 'Content-Type: application/json' -d '{"tx":"tx_+I0LAfhCuECbViGKwaxislzIUnNjV5MLIOfbFo4l7/7/WvFv4CV8FlE048akHGzYPMTsvmA123I1/eeFEUrAZ9imxrfdHGQAuEX4QyACoQGEDJdLlxZHdkVLoRnYTtxNYFio3skrbtxXirLTC0xCAAGKdGVzdC5jaGFpbiqJB0xS1EQgCUAAhg7lxBTYAABDQWRx"}'
+ jq .
{
  "tx_hash": "th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH"
}
+ curl http://localhost:3013/v3/transactions/th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH
+ jq .
{
  "block_hash": "none",
  "block_height": -1,
  "hash": "th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH",
  "signatures": [
    "sg_MKhf1mXVSBxeSAsgxCHnnDLGgMhTp2ZFC8Pd4Hsgz9x6UpqWwuG1FvwVd7ey2HE8Qs75egQPiWUpfqYzTD7WxWRJpmG1y"
  ],
  "tx": {
    "account_id": "ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E",
    "fee": 16380000000000,
    "name": "test.chain",
    "name_fee": 134626900000000000000,
    "name_salt": 42,
    "nonce": 1,
    "type": "NameClaimTx",
    "version": 2
  }
}
+ sleep 5
+ curl http://localhost:3013/v3/transactions/th_KDrAF72zV33smES1uCCqgZDvXfg66PvRJd8PWNyKs4d93gTyH
+ jq .
{
  "reason": "Transaction not found"
}

Docker compose file

version: '3'
services:
  node:
    image: aeternity/aeternity:v6.11.0
    hostname: node
    ports: ["3013:3013", "3113:3113", "3014:3014", "3114:3114"]
    volumes:
      - ./aeternity.yaml:/home/aeternity/node/aeternity.yaml
      - ./accounts_test.json:/home/aeternity/node/data/aecore/.genesis/accounts_test.json

node configuration

peers: []

http:
  external:
    port: 3013

chain:
  persist: false
  hard_forks:
    "1": 0
    "5": 1

mining:
  autostart: true
  beneficiary: "ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688"
  expected_mine_rate: 1000
  micro_block_cycle: 300
  strictly_follow_top: true
  cuckoo:
    miner:
      executable: mean15-generic
      extra_args: ""
      edge_bits: 15

fork_management:
  network_id: "ae_devnet"

accounts_test.json

{
  "ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E": 100000000000000000000000000000000000000000
}
@davidyuk davidyuk added the need/triage New issues which need to be categorized label Sep 20, 2023
@hanssv
Copy link
Member

hanssv commented Oct 23, 2023

No, wait... We've just made the NamePreclaim optional, you can't both have the cookie and eat it?! 😅

@davidyuk
Copy link
Member Author

davidyuk commented Nov 2, 2023

I'm not sure about the current state, this ticket probably about the latest released version. I'm ok to close it if it is decided to make NamePreclaim not necessary.

@hanssv
Copy link
Member

hanssv commented Nov 7, 2023

Yes #4201 is already merged making NamePreclaim optional from Ceres protocol upgrade.

What is asked for here is a mempool thing, i.e. it could technically be implemented directly, but I'm not sure there is a huge gain?

@davidyuk davidyuk closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage New issues which need to be categorized
Projects
None yet
Development

No branches or pull requests

2 participants