IoTone / TheShellProject

The Shell Project aims to build a viable general purpose blockchain written in Dlang, with attributes of security, ease of deployment, clear specification, ease of use for DAPPs, and multiple implementation interop
1 stars 1 forks source link

Fix proto6 build issues #60

Closed truedat101 closed 3 years ago

truedat101 commented 5 years ago

As I've stated repeatedly, we can't leave the build broken. It needs to be fixed.

truedat101 commented 5 years ago

current build issues:

source/addresscore.d(60,39): Error: undefined identifier crypto_hash_sha256_BYTES
source/addresscore.d(64,27): Error: undefined identifier step3ByteToRipemd
source/addresscore.d(66,30): Error: undefined identifier step3ByteToRipemd
source/addresscore.d(70,28): Error: cannot implicitly convert expression step6EncodeToBase32 of type const(char)[] to ubyte[]
source/addresscore.d(80,15): Deprecation: shelld.persistence.dddb is not visible from module addresscore
source/addresscore.d(80,15): Error: import shelld.persistence.dddb is used as a type
source/addresscore.d(82,10): Error: undefined identifier storeAdressStatus
source/addresscore.d(83,9): Error: undefined identifier storeAdressStatus
source/addresscore.d(85,9): Error: undefined identifier storeAdressStatus
source/addresscore.d(89,12): Error: undefined identifier storeAdressStatus
source/keypair.d(150,19): Deprecation: shelld.persistence.dddb is not visible from module keypair
source/keypair.d(150,19): Error: import shelld.persistence.dddb is used as a type
ldc2 failed with exit code 1.
truedat101 commented 5 years ago

@pedroalvesbatista this is fixed again. However, you need to stop doing broken checkins that sit for weeks broken. Whatever is checked in is scribble that doesn't compile. If you need to checkin broken code, do it on a feature branch.

pedroalvesbatista commented 5 years ago

I putted the same content of app.d inside unittest, to call the methods that generates hash, keypair and RIPEMD, but I stepped down into this error :

`object.Exception@../../../../../.dub/packages/dddb-0.0.6/dddb/source/dddb.d(84): Error: value already exists exists`
`??:? void dddb.ddb.set(immutable(char)[], immutable(char)[]) [0x809daa98]`
``??:? int shelld.keypair.storeKeyPair(immutable(char)[], ubyte[]) [0x809a0e4f]``
`??:? ubyte[] shelld.keypair.privateKey(ubyte[]) [0x809a0cf6]`
`??:? void shelld.keypair.__unittestL173_9() [0x809a0eee]`
`??:? void shelld.keypair.__modtest() [0x809d9a70]`
`??:? int core.runtime.runModuleUnitTests().__foreachbody2(object.ModuleInfo*) [0x80a0ebd8]`
`??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) [0x809df072]`
`??:? int rt.minfo.moduleinfos_apply(scope int` `delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_elf_shared.DSO) 0x809ed6dd]`
`??:? int rt.sections_elf_shared.DSO.opApply(scope int delegate(ref rt.sections_elf_shared.DSO)) [0x809ed76c]`
`??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))) [0x809ed669]`
`??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)) [0x809df049]`
`??:? runModuleUnitTests [0x80a0eabc]`
`??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x809e849a]`
`??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x809e8433]`
`??:? _d_run_main [0x809e83a3]`
`??:? main [0x80986cd1]`
`??:? __libc_start_main [0xee0a72e0]`
pedroalvesbatista commented 5 years ago

For what I can see, this is something related to some wrapping rules, returning all the pointers references of the calling objects.

truedat101 commented 5 years ago

That's a dddb exception. Simply put, you can't add a value if it already exists?

truedat101 commented 5 years ago

If you are doing a .set I guess you can't overwrite an existing value (think RDBMS insert). If you want to modify a value, do an .update . Alternatively, do a delete first if the record exists, and then set.

pedroalvesbatista commented 5 years ago

I don't get it, where am I trying to recall an insert ?

truedat101 commented 5 years ago

You have to read the stack trace. The first line is the exception. object.Exception. That's just a generic exception thrown by lazy devs. So the next part is the Error message. Value already set.

Next line is the culprit: void dddb.ddb.set(immutable(char)[], immutable(char)[]) [0x809daa98]

I don't know why you don't have line numbers, but I think that's because this is running inside of the test harness.

truedat101 commented 5 years ago

Since you haven't checked in the code, I can't help you further. You have to learn to read the stack trace. This is your code you've added to addresscore.d.

truedat101 commented 5 years ago

Ok, I had the wrong file. Look in keyair.d:

https://github.com/IoTone/TheShellProject/blame/60-fix-compile-errors-proto6/shell-d/prototype/source/keypair.d#L155

I fixed whatever code was in there originally, but this won't work after the first run. So, before you set a key, check if key's value already exists. It's not complaining about the key. It's actually able to store multiple values per key. The value you are saving is exactly the same. So do the following, check if the value is there, and if it is, then do an update (overwrite).

if (db.havevalue(key, value.assumeUTF) == false) {
   db.set(key, value.assumeUTF);
} else {
   db.update(key, value.assumeUTF);
}
pedroalvesbatista commented 5 years ago

After removing all the former parts which was raising errors, this odd error is still on the way.

object.Exception@../../../../../.dub/packages/dddb-0.0.6/dddb/source/dddb.d(84): Error: value already exists exists ---------------- ??:? [0xebce5dee] ??:? [0xebced29a] ??:? [0xebcd7c32] ??:? [0xebca0878] ??:? [0xebc898f0] ??:? [0xebc89826] ??:? [0xebc95dd3] ??:? [0xebcd7a9e] ??:? [0xebcd7a5d] ??:? [0xebcd7954] ??:? [0xebc95f64] ??:? __libc_start_main [0xfd532e0] ??:? [0xebc892a9]

I'll try to reach the dddb file and put code above, to check for previous existence of keys.

truedat101 commented 5 years ago

Nothing odd, if value exists. Can you commit your code so I can look?

pedroalvesbatista commented 5 years ago

Oops, fixed it !

Actually, no need to put hands on the dddb code, just verify inside the storeKeyPair.

truedat101 commented 5 years ago

Work happening on: origin/60-fix-compile-errors-proto6

truedat101 commented 3 years ago

Kill the branch.

truedat101 commented 3 years ago

Close it.