solana_bump.sol 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // RUN: --target solana --emit cfg
  2. contract C1 {
  3. @payer(payer)
  4. @space(57)
  5. @bump(25)
  6. constructor(@seed bytes my_seed) {
  7. print("In C1");
  8. }
  9. // BEGIN-CHECK: solang_dispatch
  10. // 25 must be the last seed in the call.
  11. // CHECK: external call::regular address:address 0x0 payload:%instruction.temp.15 value:uint64 0 gas:uint64 0 accounts:%metas.temp.11 seeds:[1] [ [2] [ bytes(%my_seed), bytes((alloc bytes uint32 1 "\u{19}")) ] ] contract|function:_ flags:
  12. }
  13. contract C2 {
  14. @payer(payer)
  15. @space(57)
  16. @seed("apple")
  17. @bump(12)
  18. @seed("pine_tree")
  19. constructor(@seed bytes my_seed) {
  20. print("In C2");
  21. }
  22. // BEGIN-CHECK: solang_dispatch
  23. // 12 must be the last seed in the call.
  24. // CHECK: external call::regular address:address 0x0 payload:%instruction.temp.27 value:uint64 0 gas:uint64 0 accounts:%metas.temp.23 seeds:[1] [ [4] [ (alloc slice bytes1 uint32 5 "apple"), (alloc slice bytes1 uint32 9 "pine_tree"), bytes(%my_seed), bytes((alloc bytes uint32 1 "\u{c}")) ] ] contract|function:_ flags:
  25. }
  26. contract C3 {
  27. @payer(payer)
  28. @space(57)
  29. @seed("pineapple")
  30. @seed("avocado")
  31. constructor(@bump uint8 bp, @seed bytes my_seed) {
  32. print("In C3");
  33. }
  34. // BEGIN-CHECK: solang_dispatch
  35. // bp must be the last seed in the call
  36. // CHECK: external call::regular address:address 0x0 payload:%instruction.temp.40 value:uint64 0 gas:uint64 0 accounts:%metas.temp.36 seeds:[1] [ [4] [ (alloc slice bytes1 uint32 9 "pineapple"), (alloc slice bytes1 uint32 7 "avocado"), bytes(%my_seed), bytes(bytes from:bytes1 (%bp)) ] ] contract|function:_ flags:
  37. }