wip-account-creation #4

Merged
lash merged 143 commits from wip-account-creation into master 2024-08-30 14:37:58 +02:00
5 changed files with 31 additions and 31 deletions
Showing only changes of commit e521145faa - Show all commits

View File

@ -24,8 +24,8 @@ const (
USERFLAG_ACCOUNT_PENDING USERFLAG_ACCOUNT_PENDING
lash marked this conversation as resolved
Review

Please add a documentation line on each.

Please add a documentation line on each.
Review

priority

**priority**
USERFLAG_ACCOUNT_SUCCESS USERFLAG_ACCOUNT_SUCCESS
USERFLAG_ACCOUNT_UNLOCKED USERFLAG_ACCOUNT_UNLOCKED
invalidRecipient USERFLAG_INVALID_RECIPIENT
invalidRecipientWithInvite USERFLAG_INVALID_RECIPIENT_WITH_INVITE
USERFLAG_INCORRECTPIN USERFLAG_INCORRECTPIN
) )
@ -326,9 +326,6 @@ func (fsd *fsData) validate_recipient(ctx context.Context, sym string, input []b
res := resource.Result{} res := resource.Result{}
recipient := string(input) recipient := string(input)
res.FlagReset = []uint32{invalidRecipient}
res.FlagReset = []uint32{invalidRecipientWithInvite}
fp := fsd.path + "_data" fp := fsd.path + "_data"
jsonData, err := os.ReadFile(fp) jsonData, err := os.ReadFile(fp)
@ -342,24 +339,26 @@ func (fsd *fsData) validate_recipient(ctx context.Context, sym string, input []b
return res, err return res, err
} }
// mimic invalid number check if recipient != "0" {
if recipient == "000" { // mimic invalid number check
res.FlagSet = []uint32{invalidRecipient} if recipient == "000" {
res.Content = recipient res.FlagSet = append(res.FlagSet, USERFLAG_INVALID_RECIPIENT)
res.Content = recipient
return res, nil return res, nil
} }
accountData["Recipient"] = recipient accountData["Recipient"] = recipient
updatedJsonData, err := json.Marshal(accountData) updatedJsonData, err := json.Marshal(accountData)
if err != nil { if err != nil {
return res, err return res, err
} }
err = os.WriteFile(fp, updatedJsonData, 0644) err = os.WriteFile(fp, updatedJsonData, 0644)
if err != nil { if err != nil {
return res, err return res, err
}
} }
return res, nil return res, nil
@ -393,8 +392,8 @@ func (fsd *fsData) transaction_reset(ctx context.Context, sym string, input []by
return res, err return res, err
} }
res.FlagReset = []uint32{invalidRecipient} res.FlagReset = append(res.FlagReset, USERFLAG_INVALID_RECIPIENT, USERFLAG_INVALID_RECIPIENT_WITH_INVITE)
res.FlagReset = []uint32{invalidRecipientWithInvite}
return res, nil return res, nil
} }

View File

@ -1,9 +1,11 @@
LOAD max_amount 0 RELOAD validate_recipient
CATCH invalid_recipient 13 1
LOAD max_amount 10
MAP max_amount MAP max_amount
MOUT back 0 MOUT back 0
HALT HALT
INCMP ^ 0 INCMP _ 0
LOAD validate_amount 0 LOAD validate_amount 64
LOAD get_recipient 12 LOAD get_recipient 12
LOAD get_sender 64 LOAD get_sender 64
MOVE transaction_pin INCMP transaction_pin *

View File

@ -1,5 +1,5 @@
MAP validate_recipient MAP validate_recipient
LOAD transaction_reset 0 RELOAD transaction_reset
MOUT retry 1 MOUT retry 1
MOUT quit 9 MOUT quit 9
HALT HALT

View File

@ -1,7 +1,6 @@
LOAD transaction_reset 0 LOAD transaction_reset 0
MOUT back 0 MOUT back 0
HALT HALT
INCMP ^ 0 LOAD validate_recipient 20
LOAD validate_recipient 0 INCMP _ 0
MAP validate_recipient INCMP amount *
MOVE amount

View File

@ -7,5 +7,5 @@ MAP get_sender
MOUT back 0 MOUT back 0
MOUT quit 9 MOUT quit 9
HALT HALT
INCMP ^ 0 INCMP _ 0
Alfred-mk marked this conversation as resolved Outdated
Outdated
Review

This stops and gets stuck on correct pin put:

124125 will receive 22 from 0xA780F64fC93D8e78C20c4120f9E18AeEBeaD9631
Please enter your PIN to confirm:
0:Back
9:quit
1234
[I] engine:engine.go:173 new VM execution with input    input=1234
[D] engine:engine.go:182 start new VM run       code=0008015f0130000804717569740139
[T] vm:runner.go:81 new vm run
[D] vm:runner.go:113 execute code       opcode=8, op=INCMP, code=015f0130000804717569740139
[D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x081b09 path: root/main/send/amount/transaction_pin lang: eng (English)
[T] vm:runner.go:361 testing sym        sym=_, input=31323334
[D] vm:runner.go:113 execute code       opcode=8, op=INCMP, code=04717569740139
[D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x091b09 path: root/main/send/amount/transaction_pin lang: eng (English)
[T] vm:runner.go:361 testing sym        sym=quit, input=31323334
[T] vm:runner.go:200 no code remaining but not terminating
[D] vm:runner.go:113 execute code       opcode=6, op=MOVE, code=065f6361746368
[D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x091b09 path: root/main/send/amount/transaction_pin lang: eng (English)
[T] engine:persist.go:47 that's a wrap  engine={0xc000140b00 0xc0000721a0}
[D] persist:fs.go:70 saved state and cache      key=aaaaa, bytecode=, flags=091b09
loop exited with error: unexpected termination: open /srv/git/grassrootseconomics/urdt-ussd.git/services/registration/_catch.bin: no such file or directory

exit status 1

This stops and gets stuck on correct pin put: ``` 124125 will receive 22 from 0xA780F64fC93D8e78C20c4120f9E18AeEBeaD9631 Please enter your PIN to confirm: 0:Back 9:quit 1234 [I] engine:engine.go:173 new VM execution with input input=1234 [D] engine:engine.go:182 start new VM run code=0008015f0130000804717569740139 [T] vm:runner.go:81 new vm run [D] vm:runner.go:113 execute code opcode=8, op=INCMP, code=015f0130000804717569740139 [D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x081b09 path: root/main/send/amount/transaction_pin lang: eng (English) [T] vm:runner.go:361 testing sym sym=_, input=31323334 [D] vm:runner.go:113 execute code opcode=8, op=INCMP, code=04717569740139 [D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x091b09 path: root/main/send/amount/transaction_pin lang: eng (English) [T] vm:runner.go:361 testing sym sym=quit, input=31323334 [T] vm:runner.go:200 no code remaining but not terminating [D] vm:runner.go:113 execute code opcode=6, op=MOVE, code=065f6361746368 [D] vm:runner.go:114 state=moves: 44 idx: 0 flags: 0x091b09 path: root/main/send/amount/transaction_pin lang: eng (English) [T] engine:persist.go:47 that's a wrap engine={0xc000140b00 0xc0000721a0} [D] persist:fs.go:70 saved state and cache key=aaaaa, bytecode=, flags=091b09 loop exited with error: unexpected termination: open /srv/git/grassrootseconomics/urdt-ussd.git/services/registration/_catch.bin: no such file or directory exit status 1 ```
INCMP quit 9 INCMP quit 9