Polkadot-Blockchain-Academy / pba-content

An intensive academic program teaching Blockchain, Substrate, and Polkadot.
https://polkadot-blockchain-academy.github.io/pba-content/
MIT License
57 stars 28 forks source link

PBA Buenos Aries Notes and Feedback #437

Closed shawntabrizi closed 1 year ago

shawntabrizi commented 1 year ago
shawntabrizi commented 1 year ago

Module 1

nuke-web3 commented 1 year ago

My WIP stuff from BA 2023:

1.1

Econ

Mod 3

day 1
JoshOrndorff commented 1 year ago

many signatures can be valid for the same data IIRC.

indeed https://en.wikipedia.org/wiki/Probabilistic_encryption aka "randomized encryption". This is an important feature because otherwise encrypting the same message multiple times yields the same ciphertext. Imagine we have a standing daily meeting and I send you the message, "Let's delay our 11:00 meeting until noon today." on occasion. If that yields the same ciphertext each time, the adversary would soon notice.

shawntabrizi commented 1 year ago

update notes on what lossy vs/ lossless is

The way i understood the diagram and those notes, is the following:

So in the world of one way functions, these two have been specifically crafted for the features we wish to gain from them, and those features are derived from the fact that they are lossy or lossless.

shawntabrizi commented 1 year ago

Module 3

shawntabrizi commented 1 year ago

Module 4

shawntabrizi commented 1 year ago

Add a section in FRAME to go over pallet::config, things like pallet::constant, configurable get, conversion trait, etc...

shawntabrizi commented 1 year ago

improve final assignment for frame to clarity the "price api" and it NOT being an RPC

shawntabrizi commented 1 year ago

Student Feedback

shawntabrizi commented 1 year ago

For the rust exam improvements:

^^^^ unfortunately still seeing a lot of unnecessary unwraps in some of the projects submitted.

Thankfully, some of them are "safe", but just really non-ergonomic use of Rust.

Here is a small primer:

#[derive(Default)]
struct StorageValue {
    value: Option<u32>,
}
impl StorageValue {
    pub fn get(&self) -> Option<u32> {
        self.value
    }

    pub fn set(mut self, v: Option<u32>) {
        self.value = v;
    }

    pub fn put(mut self, v: u32) {
        self.value = Some(v);
    }
}

enum PalletError {
    NoValueSet,
}

fn my_function() -> Result<(), PalletError> {
    let MyStorage = StorageValue::default();

    // Read some storage, if NONE return an error
    let value = MyStorage.get().ok_or(PalletError::NoValueSet)?;

    // Anti-pattern. Don't do this!
    let maybe_value = MyStorage.get();
    if maybe_value.is_none() {
        return Err(PalletError::NoValueSet)
    }
    let value = maybe_value.unwrap();
    // This is at least a little better, but still an anti-pattern
    let value = maybe_value.expect("cannot panic because of `none` check right above. q.e.d");

    // Do some logic only if a storage value exists, but don't return an error
    // which would halt the whole extrinsic.
    if let Some(value) = MyStorage.get() {
        // do things with value
        // If there is no value, then this code will never execute.
    }

    // This is okay... but probably means you should be using `ValueQuery` configuration.
    // Can't really make a simple example here of `ValueQuery`. Check the presentations.
    // So probably again an anti-pattern.
    let value = MyStorage.get().unwrap_or_default();

    Ok(())
}
image
shawntabrizi commented 1 year ago

I honestly do not see the game theory parts of the course show up in their final projects. Many people making really bad state machines, or ones which are not really good against all malicious actors.

I think we should be much more concrete about designing games for the blockchain in the game theory section.

shawntabrizi commented 1 year ago

Sergey:

nuke-web3 commented 1 year ago

Update from student Nate Armstrong there who took great notes:

In case anyone wants to go over things we learned in the class that aren't necessarily present in the slides, I collated most of the questions and answers that I took notes on during PBA into a github gist here. It's mostly complete, about 7k words, and hopefully useful! The sections on FRAME and polkadot are by far the most complete.

Kian remarked it also helps us to see which points were ambiguous, and how to improve.

nuke-web3 commented 1 year ago

I think the feedback is incorporated or well on it's way to be for UCB.

https://github.com/Polkadot-Blockchain-Academy/pba-content/issues/437#issuecomment-1412339144 I think we will see if the "assignment 0" helps get some things like this more well understood.